home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / e_os300b / ex_noise / exampl10.asm next >
Encoding:
Assembly Source File  |  1996-11-12  |  2.8 KB  |  86 lines

  1. ;╔══════════════════════════════════════════════════════════════════════════╗
  2. ;║                                                                          ║
  3. ;║ This example show how to play a sample                                   ║
  4. ;║                                                                          ║
  5. ;║ Tabs : 13 21 29 37                                                       ║
  6. ;║                                                                          ║
  7. ;╚══════════════════════════════════════════════════════════════════════════╝
  8.  
  9. Locals
  10. .386
  11. CODE32 SEGMENT PUBLIC PARA 'CODE' USE32
  12. ASSUME  CS:CODE32,DS:CODE32,ES:CODE32
  13.  
  14. INCLUDE ..\RESOURCE\EOS.INC
  15.  
  16. Module_Name db '..\data\testsmpl.mod',0
  17.  
  18. Msg_Module  db '    ■ Module Not Found...',13,10,36
  19. Msg_Playing db '    ■ Press Space to play a sample...',13,10,36
  20.  
  21.  
  22. Start32:
  23.             mov ah,Use_Int_09       ; Use Internal Keyboard handler to use keyboard
  24.             mov bx,On
  25.             Int_EOS
  26.  
  27.             mov ah,Detect_Sound_Card
  28.             xor bx,bx               ; Find the Best One (Gravis ;))
  29.             mov cx,1                ; Display the results
  30.             Int_EOS                 ; You must use this function before using
  31.                                     ; the player
  32.  
  33.             mov ah,Load_Module
  34.             mov al,0                ; Normal Load
  35.             mov bx,44000            ; Set Replay Rate For SB
  36.             mov ecx,1               ; Number Of Track For Sample
  37.             mov edx,O Module_Name
  38.             Int_EOS
  39.             jnc Load_Ok             ; Can Load ??
  40.  
  41.             mov ah,Exit_Error       ; No Exit with Exit_Error function
  42.             mov edx,O Msg_Module    ; en Display Message
  43.             Int_EOS
  44. Load_Ok:
  45.  
  46.             mov ah,Play_Module      ; Start playing module
  47.             Int_EOS
  48.             mov [Master_Volume],32      ; Set Music Volume
  49.             mov [Master_Volume_Sfx],63  ; Set Sample Volume
  50.  
  51.             mov ah,9                ; Display Message
  52.             mov edx,O Msg_Playing
  53.             int 21h
  54.  
  55. @@again:
  56.             cmp Key_Map[Escape],On  ; Escape ?
  57.             je @@end
  58.             cmp Key_Map[Space],On   ; Space ?
  59.             jne @@again
  60.  
  61.             mov ah,Play_Sample
  62.             mov cx,339              ; Freq.
  63.             mov dx,00               ; Piste Sample 0
  64.             mov bx,09h              ; Sample number
  65.             Int_EOS
  66.  
  67. @@wait:
  68.             cmp Key_Map[Space],Off  ; Space ?
  69.             jne @@wait
  70.  
  71.             jmp @@again
  72.  
  73. @@end:
  74.             mov ah,Stop_Module      ; Stop  playing module
  75.             Int_EOS
  76.  
  77.             mov ah,Clear_Module     ; Unload module From memory
  78.             Int_EOS
  79.  
  80.             mov ax,4c00h            ; Exit with error code 0
  81.             int 21h
  82.  
  83.  
  84.             CODE32 ENDS
  85.  
  86.             END